#!/bin/bash
dir_prefix="67.33"
rsyncd_host="192.168.0.44"


#mkdir -p /home/yangrong/{mgt_"$dir_prefix",apps_"$dir_prefix"}

find /usr/local/tomcat_mgt_new/logs/* -type f -name "localhost_access_log.*" -mtime -60 -a ! -name localhost_access_log.`date +"%Y-%m-%d"`.txt -exec basename {} \;>/home/yangrong/mgt_"$dir_prefix".txt

find /usr/local/tomcat_Apps/logs/* -type f -name "localhost_access_log.*" -mtime -60 -a ! -name localhost_access_log.`date +"%Y-%m-%d"`.txt -exec basename {} \;>/home/yangrong/apps_"$dir_prefix".txt

/usr/bin/rsync -arv --delete --files-from=/home/yangrong/mgt_"$dir_prefix".txt /usr/local/tomcat_mgt_new/logs/ rsync@192.168.0.44::mgtlog/mgt_"$dir_prefix"/ --password-file=/home/yangrong/mgt_log_rsync.pas

/usr/bin/rsync -arv --delete --files-from=/home/yangrong/apps_"$dir_prefix".txt /usr/local/tomcat_Apps/logs/ rsync@192.168.0.44::mgtlog/apps_"$dir_prefix"/ --password-file=/home/yangrong/mgt_log_rsync.pas

rm -rf /home/yangrong/{mgt_"$dir_prefix".txt,apps_"$dir_prefix".txt}
